<?php

//Floor
class Form_Floor_Create extends Base_Form
{
    public function init()
    {
		$this->addElements(array(
			// Add an hidden element
            new Zend_Form_Element_Hidden('vid', array(
                'required'   => true,
				'value'      => 0,
				'decorators' =>array(
					'ViewHelper', 'Errors',
				),
                'validators' => array(
					array('validator'=> 'Int')
                )
            )),
			// Add an hidden element
            new Zend_Form_Element_Hidden('gid', array(
                'required'   => true,
				'value'      => 0,
				'decorators' =>array(
					'ViewHelper', 'Errors',
				),
                'validators' => array(
					array('validator'=> 'Int')
                )
            )),
			// Add an username element
            new Zend_Form_Element_Text('number', array(
                'required'   => true,
                'label'      => 'Number:',
                'filters'    => array('StringTrim'),
                'validators' => array(
					array('validator' => 'Between', 'options' => array('min'=> 1, 'max'=> 100))
                )
            )),
			// Add an username element
            new Zend_Form_Element_Text('units', array(
                'required'   => true,
                'label'      => 'Units:',
                'filters'    => array('StringTrim'),
                'validators' => array(
					array('validator' => 'Between', 'options' => array('min'=> 1, 'max'=> 10))
                )
            )),
			// Add an username element
            new Zend_Form_Element_Text('level', array(
                'required'   => true,
                'label'      => 'Level:',
                'filters'    => array('StringTrim'),
                'validators' => array(
					array('validator' => 'Between', 'options' => array('min'=> 4, 'max'=> 6))
                )
            )),
			// Add an username element
            new Zend_Form_Element_Text('family', array(
                'required'   => true,
                'label'      => 'Family:',
                'filters'    => array('StringTrim'),
                'validators' => array(
                	array('validator' => 'Regex', 'options' => "/^\d(,\d){0,9}$/"),
                )
            )),
        ));

        $this->addDisplayGroup(
            array('number','units','level','family'), 'floor',
			array(
				'legend' => 'Floor'
			)
		);
    }
}